/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hijh.uniandes.ecos.runt.persistence;

import hijh.uniandes.ecos.runt.bll.*;

/**
 *
 * @author Usuario
 */
public class RNLMockModel {
    
    public RNLMockModel(){
    }
    
    /*public RNLVO LoadVO(String uuid) {
        if(_volist.containsKey(uuid))
            return _volist.get(uuid);
        else
            return null;
    }*/
    
    public RNLVO LoadVO(String uuid) {
        RNLRecord record = RNLOperation.GetRecordById(uuid);
        if(record!=null)
            return record.toRNLVO();
        else
            return null;
    }
    
    public void SaveVO(RNLVO vo){
        //Persistimos el registro a la base de datos
        RNLOperation.AddRecord(vo.toRNLRecord());
    }

    public void RemoveVO(String uuid){
        RNLOperation.RemoveRecordById(uuid);
    }
    
    public RNLVOInfo[] GetAllVOs(){
        java.util.Collection<RNLRecord> records = RNLOperation.GetAllRecords();
        RNLVOInfo[] _voarray = new RNLVOInfo[records.size()];
        java.util.Iterator<RNLRecord> iterator = records.iterator();
        for(int index=0;iterator.hasNext();index++){
            RNLVO vo = iterator.next().toRNLVO();
            _voarray[index] = new RNLVOInfo();
            _voarray[index].setInfo(vo);
        }
        return _voarray;
    }
    
}
